home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-4.0 / bfd / configure < prev    next >
Encoding:
Text File  |  1991-08-24  |  21.4 KB  |  820 lines

  1. #!/bin/sh
  2. # Please do not edit this file.  It is generated automatically from
  3. # configure.in and a configure template.
  4. configdirs=
  5.  
  6. #!/bin/sh
  7.  
  8. # Configuration script template
  9. #   Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
  10.  
  11. #This file is part of GNU.
  12.  
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version.
  17. # This program is distributed in the hope that it will be useful,
  18. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. # GNU General Public License for more details.
  21. # You should have received a copy of the GNU General Public License
  22. # along with this program; if not, write to the Free Software
  23. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  24.  
  25. # $Id: configure,v 1.31 1991/08/23 04:50:57 rich Exp $
  26.  
  27. #
  28. # Shell script to create proper links to machine-dependent files in
  29. # preparation for compilation.
  30. #
  31. # If configure succeeds, it leaves its status in config.status.
  32. # If configure fails after disturbing the status quo, 
  33. #     config.status is removed.
  34. #
  35.  
  36. remove=rm
  37. hard_link=ln
  38. symbolic_link='ln -s'
  39.  
  40. #for Test
  41. #remove="echo rm"
  42. #hard_link="echo ln"
  43. #symbolic_link="echo ln -s"
  44.  
  45. progname=$0
  46.  
  47. # clear some things potentially inherited from environment.
  48. ansi=
  49. defaulttargets=
  50. destdir=
  51. fatal=
  52. hostsubdir=
  53. Makefile=Makefile
  54. Makefile_in=Makefile.in
  55. norecurse=
  56. recursing=
  57. removing=
  58. srcdir=
  59. srctrigger=
  60. target=
  61. targets=
  62. commontargets=
  63. targetsubdir=
  64. template=
  65. verbose=
  66.  
  67. for arg in $*;
  68. do
  69.     case ${arg} in
  70.     -ansi | +a*)
  71.         ansi=true
  72.         clib=clib
  73.         ;;
  74.     -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
  75.         destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
  76.         ;;
  77.     -languages=* | +languages=* | +language=* | +languag=* \
  78.         | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
  79.         | +l=*)
  80.         languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
  81.         ;;
  82.     -gas | +g*)
  83.         gas=yes
  84.         ;;
  85.     -help | +h*)
  86.         fatal=true
  87.         ;;
  88.     -nfp | +nf*)
  89.         nfp=yes
  90.         ;;
  91.     -norecurse | +no*)
  92.         norecurse=true
  93.         ;;
  94.     -recursing)
  95.         recursing=true
  96.         ;;
  97.     -rm | +r*)
  98.         removing=${arg}
  99.         ;;
  100. #    -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  101. #        srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
  102. #        ;;
  103.     -subdirs | +f* | +su*)
  104.         subdirs=${arg}
  105.         ;;
  106.     -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
  107.         if [ -n "${targets}" ] ; then
  108.             subdirs="+subdirs"
  109.         fi
  110.  
  111.         newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
  112.         targets="${newtargets}"
  113.         ;;
  114.     -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
  115.         template=`echo ${arg} | sed 's/[+-]template=//'`
  116.         ;;
  117.     -v | -verbose | +v*)
  118.         verbose=${arg}
  119.         ;;
  120.     -* | +*)
  121.         (echo ;
  122.         echo "Unrecognized option: \"${arg}\"". ;
  123.         echo) 1>&2
  124.         fatal=true
  125.         ;;
  126.     *)
  127.         if [ -n "${hosts}" ] ; then
  128.             subdirs="+subdirs"
  129.         fi
  130.  
  131.         newhosts="${hosts} ${arg}"
  132.         hosts=${newhosts}
  133.         ;;
  134.     esac
  135. done
  136.  
  137. if [ -n "${verbose}" ] ; then
  138.     echo `pwd`/configure $*
  139. fi
  140.  
  141. # process host and target only if not rebuilding configure itself or removing.
  142. if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
  143.     # Complain if an arg is missing
  144.     if [ -z "${hosts}" ] ; then
  145.         (echo ;
  146.         echo "configure: No HOST specified." ;
  147.         echo) 1>&2
  148.         fatal=true
  149.     fi
  150. fi
  151.  
  152. if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
  153.     (echo "Usage: configure HOST" ;
  154.     echo ;
  155.     echo "Options: [defaults in brackets]" ;
  156.     echo " +ansi        configure w/ANSI library. [no ansi lib]" ;
  157.     echo " +destdir=MYDIR    configure for installation into MYDIR. [/usr/local]" ;
  158.     echo " +subdirs        configure in subdirectories.  [in source directories]" ;
  159.     echo " +lang=LANG    configure to build LANG. [gcc]" ;
  160.     echo " +help        print this message. [normal config]" ;
  161.     echo " +gas        configure the compilers for use with gas. [native as]" ;
  162.     echo " +nfp        configure the compilers default to soft floating point. [hard float]" ;
  163.     echo " +norecurse    configure this directory only. [recurse]" ;
  164.     echo " +rm        remove this configuration. [build a configuration]" ;
  165.     echo " +target=TARGET    configure for TARGET.  [TARGET = HOST]" ;
  166.     echo " +template=TEM    rebuild configure using TEM. [normal config]" ;
  167.     echo ;
  168.     echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
  169.     echo "Asking for more than one \"+target\" implies \"+subdirs\".  Any other" ;
  170.     echo "options given will apply to all targets.") 1>&2
  171.  
  172.     if [ -r config.status ] ; then
  173.         cat config.status
  174.     fi
  175.  
  176.     exit 1
  177. fi
  178.  
  179. #### configure.in common parts come in here.
  180. # This file is a shell script that supplies the information necessary
  181. # to tailor a template configure script into the configure script
  182. # appropriate for this directory.  For more information, check any
  183. # existing configure script.
  184.  
  185. srctrigger=libbfd.c
  186. srcname="bfd"
  187.  
  188. ## end of common part.
  189.  
  190. # are we rebuilding config itself?
  191. if [ -n "${template}" ] ; then
  192.     if [ ! -r ${template} ] ; then
  193.         echo '***' "Can't find template ${template}." 1>&2
  194.         exit 1
  195.     fi
  196.  
  197. # prep the template
  198.     sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
  199. #### configure.in common parts come in here.\
  200. ## end of common part.' \
  201.     -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
  202. #### configure.in per-host parts come in here.\
  203. ## end of per-host part.' \
  204.     -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
  205. #### configure.in per-target parts come in here.\
  206. ## end of per-target part.' \
  207.     -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
  208. #### configure.in post-target parts come in here.\
  209. ## end of post-target part.' \
  210.     < ${template} > template.new
  211.  
  212.     if [ -r configure.in ] ; then
  213.         if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
  214.             echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
  215.             exit 1
  216.         fi
  217.  
  218.         if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
  219.             echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
  220.             exit 1
  221.         fi
  222.  
  223.         # split configure.in into common, per-host, per-target,
  224.         # and post-target parts.  Post-target is optional.
  225.         sed -e '/^# per\-host:/,$d' configure.in > configure.com
  226.         sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
  227.         if grep -s '^# post-target:' configure.in ; then
  228.           sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
  229.           sed -e '1,/^# post\-target:/d' configure.in > configure.pos
  230.         else
  231.           sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
  232.           echo >configure.pos
  233.         fi
  234.  
  235.         # and insert them
  236.         sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
  237.             -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
  238.             -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
  239.             -e '/^#### configure.in post\-target parts come in here.$/  r configure.pos' \
  240.             template.new > configure.new
  241.  
  242.         rm -f configure.com configure.tgt configure.hst configure.pos
  243.     else
  244.         echo Warning: no configure.in in `pwd`
  245.         cat ${template} >> configure
  246.     fi
  247.  
  248.     chmod a+x configure.new
  249.     rm template.new
  250. #    mv configure configure.old
  251.     mv configure.new configure
  252.  
  253.     if [ -n "${verbose}" ] ; then
  254.         echo Rebuilt configure in `pwd`
  255.     fi
  256.  
  257.     # Now update config.sub from the template directory.
  258.     if echo "$template" | grep -s 'configure$' ; then
  259.         cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
  260.     #    mv config.sub config.sub.old
  261.         mv config.sub.new config.sub
  262.  
  263.         if [ -n "${verbose}" ] ; then
  264.             echo Rebuilt config.sub in `pwd`
  265.         fi
  266.     fi
  267.  
  268.     if [ -z "${norecurse}" ] ; then
  269.         # If template is relative path, make it absolute for recursing.
  270.         if echo "${template}" | grep -s '^/' ; then
  271.            true
  272.         else
  273.            template=`pwd`/${template}
  274.         fi
  275.  
  276.         while [ -n "${configdirs}" ] ; do
  277.             # set configdir to car of configdirs, configdirs to cdr of configdirs
  278.             set ${configdirs}; configdir=$1; shift; configdirs=$*
  279.  
  280.             if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
  281.                 targetspecificdirs=${configdir}.*
  282.             else
  283.                 targetspecificdirs=
  284.             fi
  285.  
  286.             for i in ${configdir} ${targetspecificdirs} ; do
  287.                 if [ -d $i ] ; then
  288.                     if [ -r $i/configure ] ; then
  289.                         (cd $i ;
  290.                             ./configure +template=${template} ${verbose})
  291.                     else
  292.                         echo Warning: No configure script in `pwd`/$i
  293.                     fi
  294.                 else
  295.                     if [ -n "${verbose}" ] ; then
  296.                       echo Warning: directory $i is missing.
  297.                     fi
  298.                 fi
  299.             done
  300.         done
  301.     fi
  302.  
  303.     exit 0
  304. fi
  305.  
  306. # some sanity checks on configure.in
  307. if [ -z "${srctrigger}" ] ; then
  308.     echo Warning: srctrigger not set in configure.in. `pwd` not configured.
  309.     exit 1
  310. fi
  311.  
  312. for host in ${hosts} ; do
  313.     # Default other arg
  314.     if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
  315.         targets=${host}
  316.         defaulttargets=true
  317.     fi
  318.  
  319.     result=`/bin/sh ./config.sub ${host}`
  320.     host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  321.     host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  322.     host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  323.     host=${host_cpu}-${host_vendor}-${host_os}
  324.     host_makefile_frag=config/hmake-${host}
  325.  
  326. #### configure.in per-host parts come in here.
  327.  
  328. if [ "${host_os}" = "posix" ] ; then
  329.     bfd_host=posix
  330. else
  331.     case "${host_cpu}" in
  332.     rs6000)    bfd_host=aix ;;
  333.     mips)
  334.         case "${host_vendor}" in
  335.         dec)    bfd_host=dec3100 ;;
  336.         esac
  337.         ;;
  338.     m88k)
  339.         case "${host_vendor}" in
  340.         *)
  341.             case "${host_os}" in
  342.             dgux)    bfd_host=dgux ;;
  343.             esac
  344.             ;;
  345.         esac
  346.         ;;
  347.  
  348.     m68k)
  349.         case "${host_vendor}" in
  350.         hp)    
  351.             case "${host_os}" in
  352.             hpux)    bfd_host=hp9000 ;;
  353.             bsd)    bfd_host=hp300bsd ;;
  354.             esac
  355.             ;;
  356.         sony)    bfd_host=news ;;
  357.         sun)    bfd_host=sun3 ;;
  358.         esac
  359.         ;;
  360.  
  361.     i386)
  362.         case "${host_vendor}" in
  363.         *)
  364.             case "${host_os}" in
  365.             sysv)    bfd_host=i386v ;;
  366.             esac
  367.             ;;
  368.         esac
  369.         ;;
  370.  
  371.     sparc)
  372.         case "${host_vendor}" in
  373.         sun)    bfd_host=sun4 ;;
  374.         esac
  375.         ;;
  376.  
  377.     rtpc)    bfd_host=rtbsd ;;
  378.     tahoe | vax)    bfd_host=${host_cpu} ;;
  379.     esac
  380. fi
  381.  
  382. if [ ! -f config/hmake-${bfd_host} ] ; then
  383.     echo '***' BFD does not support host ${host}: no file config/hmake-${bfd_host}
  384.     exit 1
  385. fi
  386.  
  387. host_makefile_frag=config/hmake-${bfd_host}
  388.  
  389. ## end of per-host part.
  390.  
  391.     for target in ${targets} ; do
  392.  
  393.         result=`/bin/sh ./config.sub ${target}`
  394.         target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  395.         target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  396.         target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  397.         target=${target_cpu}-${target_vendor}-${target_os}
  398.         target_makefile_frag=config/tmake-${target}
  399.  
  400. #### configure.in per-target parts come in here.
  401.  
  402. case "${target_vendor}" in
  403. aout | coff | bout) bfd_target=${target_cpu}-${target_vendor} ;;
  404. sony)    bfd_target=news ;;
  405. intel)    bfd_target=${target_cpu}-coff ;;    
  406. wrs)
  407.     case "${target_cpu}" in
  408.     i960) bfd_target=i960-bout ;;
  409.     m68k) bfd_target=m68k-aout ;;
  410.     esac
  411.     ;;
  412. sun)
  413.     case "${target_cpu}" in
  414.     m68k)    bfd_target=m68k-aout ;;
  415.     sparc)    bfd_target=sparc-aout ;;
  416.     esac
  417.     ;;
  418. dec)
  419.     case "${target_cpu}" in
  420.     mips) bfd_target=dec3100 ;;
  421.     esac
  422.     ;;
  423. hp)
  424.     case "${target_cpu}" in
  425.     m68k)
  426.         case "${target_os}" in
  427.         hpux)    bfd_target=hp9000 ;;
  428.         bsd)    bfd_target=hp300bsd ;;
  429.         esac
  430.         ;;
  431.     esac
  432.     ;;
  433. none)
  434.     case "${target_cpu}" in
  435.     i386) bfd_target=i386-coff ;;
  436.     esac
  437.     ;;
  438. *)
  439.     case "${target_cpu}" in
  440.     tahoe | vax) bfd_target=${target_cpu} ;;
  441.     esac
  442.     ;;
  443. esac
  444.  
  445. if [ ! -f config/tmake-${bfd_target} ] ; then
  446.     echo '***' BFD does not support target ${target}: no file config/tmake-${bfd_target}
  447.     exit 1
  448. fi
  449.  
  450. target_makefile_frag=config/tmake-${bfd_target}
  451.  
  452. files=
  453. links=
  454. ## end of per-target part.
  455.  
  456.         # Temporarily, we support only direct subdir builds.
  457.         hostsubdir=Host-${host}
  458.         targetsubdir=Target-${target}
  459.  
  460.         if [ -n "${removing}" ] ; then
  461.             if [ -n "${subdirs}" ] ; then
  462.                 if [ -d "${hostsubdir}" ] ; then
  463.                     rm -rf ${hostsubdir}/${targetsubdir}
  464.  
  465.                     if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
  466.                         rm -rf ${hostsubdir}
  467.                     fi
  468.                 else
  469.                     echo Warning: no `pwd`/${hostsubdir} to remove.
  470.                 fi
  471.             else
  472.                 rm -f ${Makefile} config.status ${links}
  473.             fi
  474.         else
  475.             if [ -n "${subdirs}" ] ; then
  476.                 # check for existing status before allowing forced subdirs.
  477.                 if [ -f ${Makefile} ] ; then
  478.                     echo '***' "${Makefile} already exists in source directory.  `pwd` not configured." 1>&2
  479.                     exit 1
  480.                 fi
  481.  
  482.                 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
  483.                 cd ${hostsubdir}
  484.  
  485.                 if [ ! -d ${targetsubdir} ] ; then
  486.                     if [ -z "${commontargets}" ] ; then
  487.                         mkdir ${targetsubdir}
  488.                     else
  489.                         if [ ! -d Target-independent ] ; then
  490.                             mkdir Target-independent
  491.                         fi
  492.  
  493.                         ${symbolic_link} Target-independent ${targetsubdir}
  494.                     fi # if target independent
  495.                 fi # if no target dir yet
  496.  
  497.                 cd ${targetsubdir}
  498.  
  499.                 srcdir=../..
  500.             else
  501.                 # if not subdir builds, then make sure none exist.
  502.                 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
  503.                     echo '***' "Configured subdirs exist.  `pwd` not configured." 1>&2
  504.                     exit 1
  505.                 fi
  506.             fi
  507.  
  508.             # Find the source files, if location was not specified.
  509.             if [ -z "${srcdir}" ] ; then
  510.                 srcdirdefaulted=1
  511.                 srcdir=.
  512.                 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
  513.                     srcdir=..
  514.                 fi
  515.             fi
  516.  
  517.             if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
  518.                 if [ -z "${srcdirdefaulted}" ] ; then
  519.                     echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
  520.                 else
  521.                     echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
  522.                 fi
  523.  
  524.                 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  525.                 exit 1
  526.             fi
  527.  
  528.             # Set up the list of links to be made.
  529.             # ${links} is the list of link names, and ${files} is the list of names to link to.
  530.  
  531.             # Make the links.
  532.             while [ -n "${files}" ] ; do
  533.                 # set file to car of files, files to cdr of files
  534.                 set ${files}; file=$1; shift; files=$*
  535.                 set ${links}; link=$1; shift; links=$*
  536.  
  537.                 if [ ! -r ${srcdir}/${file} ] ; then
  538.                     echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  539.                     echo '***' "since the file \"${file}\" does not exist." 1>&2
  540.                     exit 1
  541.                 fi
  542.  
  543.                 ${remove} -f ${link}
  544.                 rm -f config.status
  545.                 # Make a symlink if possible, otherwise try a hard link
  546.                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
  547.  
  548.                 if [ ! -r ${link} ] ; then
  549.                     echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  550.                     exit 1
  551.                 fi
  552.  
  553.                 if [ -n "${verbose}" ] ; then
  554.                     echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  555.                 fi
  556.             done
  557.  
  558.             # Create a .gdbinit file which runs the one in srcdir
  559.             # and tells GDB to look there for source files.
  560.  
  561.             case ${srcdir} in
  562.             .)
  563.                 ;;
  564.             *)
  565.                 echo "dir ." > .gdbinit
  566.                 echo "dir ${srcdir}" >> .gdbinit
  567.                 echo "source ${srcdir}/.gdbinit" >> .gdbinit
  568.                 ;;
  569.             esac
  570.  
  571.             # Install a makefile, and make it set VPATH
  572.             # if necessary so that the sources are found.
  573.             # Also change its value of srcdir.
  574.  
  575.         # FIXME-someday: This business of always writing to .tem and mv back
  576.         # is so that I don't screw things up while developing.  Once this
  577.         # template is stable, these should be optimized. xoxorich.
  578.  
  579.             # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
  580.             if [ "${host}" != "${target}" ] ; then
  581.                 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
  582.                 echo "ALL=start.encap" >> ${Makefile}
  583.             else
  584.                 echo "ALL=all.internal" > ${Makefile}
  585.             fi
  586.  
  587.             # set target, host, VPATH
  588.             echo "host = ${host}" >> ${Makefile}
  589.             echo "target = ${target}" >> ${Makefile}
  590.  
  591.             if [ -n "${subdirs}" ] ; then
  592.                 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
  593.             else
  594.                 echo "subdir =" >> ${Makefile}
  595.             fi
  596.  
  597.         #    echo "workdir = `pwd`" >> ${Makefile}
  598.             echo "VPATH = ${srcdir}" >> ${Makefile}
  599.  
  600.             # add "Makefile.in" (or whatever it's called)
  601.             cat ${srcdir}/${Makefile_in} >> ${Makefile}
  602.  
  603.             # Conditionalize the makefile for this host.
  604.             if [ -f ${srcdir}/${host_makefile_frag} ] ; then
  605.                 sed -e "/^####/  r ${srcdir}/${host_makefile_frag}" ${Makefile} > Makefile.tem
  606.                 mv Makefile.tem ${Makefile}
  607.             fi
  608.  
  609.             # Conditionalize the makefile for this target.
  610.             if [ -f ${srcdir}/${target_makefile_frag} ] ; then
  611.                 sed -e "/^####/  r ${srcdir}/${target_makefile_frag}" ${Makefile} > Makefile.tem
  612.                 mv Makefile.tem ${Makefile}
  613.             fi
  614.  
  615.             # set srcdir
  616.             sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
  617.             mv Makefile.tem ${Makefile}
  618.  
  619.             # set destdir
  620.             if [ -n "${destdir}" ] ; then
  621.                 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
  622.                 mv Makefile.tem ${Makefile}
  623.             fi
  624.  
  625.             # reset SUBDIRS
  626.             sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
  627.             mv Makefile.tem ${Makefile}
  628.  
  629.             # reset NONSUBDIRS
  630.             sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
  631.             mv Makefile.tem ${Makefile}
  632.  
  633.             using=
  634.             if [ -f ${srcdir}/${host_makefile_frag} ] ; then
  635.                 using=" using \"${host_makefile_frag}\""
  636.             fi
  637.  
  638.             if [ -f ${srcdir}/${target_makefile_frag} ] ; then
  639.                 if [ -z "${using}" ] ; then
  640.                     andusing=" using \"${target_makefile_frag}\""
  641.                 else
  642.                     andusing="${using} and \"${target_makefile_frag}\""
  643.                 fi
  644.             else
  645.                 andusing=${using}
  646.             fi
  647.  
  648.             if [ -n "${verbose}" -o -z "${recursing}" ] ; then
  649.                 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
  650.             fi
  651.  
  652. #### configure.in post-target parts come in here.
  653.  
  654. ## end of post-target part.
  655.  
  656.             if [ "${host}" = "${target}" ] ; then
  657.                 echo "Links are now set up for use with a ${target}." \
  658.                     > config.status
  659.         #            | tee ${srcdir}/config.status
  660.             else
  661.                 echo "Links are now set up for host ${host} and target ${target}." \
  662.                     > config.status
  663.         #            | tee ${srcdir}/config.status
  664.             fi
  665.  
  666.             originaldir=`pwd`
  667.             cd ${srcdir}
  668.         fi
  669.  
  670.         # If there are subdirectories, then recurse. 
  671.         if [ -z "${norecurse}" -a -n "${configdirs}" ] ; then 
  672.             for configdir in ${configdirs} ; do
  673.                 if [ -n "${verbose}" ] ; then
  674.                     echo Configuring ${configdir}...
  675.                 fi
  676.  
  677.                 if [ -d ${configdir} ] ; then
  678.                     (cd ${configdir} ;
  679.                         ./configure -recursing ${host} +target=${target} \
  680.                             ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
  681.                         | sed 's/^/    /'
  682.                 else
  683.                     if [ -n "${verbose}" ] ; then
  684.                         echo Warning: directory \"${configdir}\" is missing.
  685.                     fi
  686.                 fi
  687.             done
  688.         fi
  689.     done # for each target
  690.  
  691.     # Now build a Makefile for this host.
  692.     if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
  693.         cd ${hostsubdir}
  694.         cat > GNUmakefile << E!O!F
  695. # Makefile generated by configure for host ${host}.
  696.  
  697. ALL := $(shell ls -d Target-*)
  698.  
  699. %:
  700.     $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
  701.  
  702. all:
  703. E!O!F
  704.         cd ..
  705.     fi
  706. done # for each host
  707.  
  708. exit 0
  709.  
  710. #
  711. # $Log: configure,v $
  712. # Revision 1.31  1991/08/23  04:50:57  rich
  713. # Minor config polish.
  714. #
  715. # Revision 1.22  1991/08/23  03:31:43  rich
  716. # Minor polish & config mapping.
  717. #
  718. # Revision 1.30  1991/08/22  07:15:51  rich
  719. # Three part names, etc.
  720. #
  721. # Revision 1.29  1991/08/20  04:56:51  rich
  722. # revisiting error messages
  723. #
  724. # Revision 1.28  1991/08/16  19:22:17  rich
  725. # This is the commontargets change and should be considered
  726. # experimental.
  727. #
  728. # Revision 1.27  1991/08/08  01:14:13  rich
  729. # allow +f to stand in for +subdirs
  730. #
  731. # Revision 1.26  1991/08/07  19:21:32  rich
  732. # +forcesubdirs -> +subdirs
  733. #
  734. # Revision 1.25  1991/08/07  07:05:30  rich
  735. # Added make.
  736. #
  737. # Revision 1.24  1991/08/06  19:26:01  rich
  738. # revised option parsing.
  739. #
  740. # Revision 1.23  1991/08/06  19:12:32  rich
  741. # Host-level GNUmakefiles.
  742. #
  743. # Revision 1.22  1991/07/20  01:22:30  rich
  744. # propogate gdb changes and destdir fix
  745. #
  746. # Revision 1.21  1991/07/20  00:55:20  gnu
  747. # Roll in new configure that handles GDB.  Make sure that the "configure"
  748. # that is checked-in reflects the latest "configure.in", which includes gdb.
  749. #
  750. # Revision 1.9  1991/07/06  04:35:51  gnu
  751. # Fix bug in configure when iterating targets.
  752. # Depend on alldeps.mak, not ${srcdir}/alldeps.mak, so it can be found
  753. # in either spot.
  754. #
  755. # Revision 1.8  1991/07/05  00:04:58  gnu
  756. # Thu Jul  4 14:47:06 1991  John Gilmore  (gnu at cygint.cygnus.com)
  757. #
  758. #         * configure.in, Makefile.in:  Avoid rebuilding "depend" as much.
  759. #         Avoid declaring Makefile dependencies, because GNU Make stupidly
  760. #         tries to update it if we do.
  761. #
  762. #         * coffread.c:  Revise for minor changes to bfd internal coff
  763. #         indexes.
  764. #
  765. #         * configure:  If -template= is given a relative path, make it
  766. #         absolute before recurring in subdirectories.
  767. #
  768. # Revision 1.7  1991/07/04  15:59:46  gnu
  769. # Make gdb work with configure.  Only thing that doesn't work is the -list
  770. # option (as far as I know).
  771. #
  772. # Revision 1.6  1991/06/04  07:28:16  gnu
  773. # Change GDB over to GNU General Public License version 2.
  774. #
  775. # Revision 1.5  1991/05/19  07:26:54  rich
  776. # configure changes and -opcode.h movement.
  777. #
  778. # Revision 1.4  1991/05/19  00:16:45  rich
  779. # Configure for gdb.
  780. #
  781. # Revision 1.10  1991/05/04  00:58:38  rich
  782. # Fix program name bug.
  783. #
  784. # Revision 1.9  1991/05/03  19:14:18  rich
  785. # Changed getopt to libiberty, commented out an aborted attempt at host
  786. # level Makefiles because it caused errors on +rm, add a warning for
  787. # directories expected to be removed on +rm but that don't exist.
  788. #
  789. # Revision 1.8  1991/04/24  16:50:59  rich
  790. # Three staging checkpoint.
  791. #
  792. # Revision 1.7  1991/04/17  01:34:47  rich
  793. # Added getopt for binutils, fixed problem with host dependancies in
  794. # configure.template.
  795. #
  796. # Revision 1.6  1991/04/16  00:18:44  rich
  797. # Now handles multiple hosts and targets.
  798. #
  799. # Revision 1.5  1991/04/15  23:43:44  rich
  800. # Now handles multiple hosts and targets.
  801. #
  802. # Revision 1.4  1991/04/13  02:11:03  rich
  803. # Config cut 3.  We now almost install a29k.
  804. #
  805. # Revision 1.3  1991/04/11  02:41:54  rich
  806. # Cut 2 config.  Subdirs.
  807. #
  808. #
  809. #
  810.  
  811. #
  812. # Local Variables:
  813. # fill-column: 131
  814. # End:
  815. #
  816.  
  817. # end of configure.template
  818.